﻿using System.IO;
using EnvDTE;

namespace SpecFlowTfsLinker.VisualStudioHelper
{
    public class VisualStudioExtensionHelper
    {
        private readonly VisualStudioItemHelper _vsItemHelper;

        public VisualStudioExtensionHelper(DTE visualStudioService)
        {
            _vsItemHelper = new VisualStudioItemHelper(visualStudioService.SelectedItems);
        }

        public ProjectItem CreateFolder(string folderName)
        {
            var pathoToFolder = Path.Combine(_vsItemHelper.GetPathFromSelectedItem(), folderName);
            Directory.CreateDirectory(pathoToFolder);
            return _vsItemHelper.GetSelectedProjectItems().AddFromDirectory(pathoToFolder);
        }
    }
}